﻿using ContractManagementSystem.BusinessLogicLayer;

namespace ContractManagementSystem.DataAccessLayer
{
    public static class AuthorizationDao
    {
        public static bool CheckAuthorization(string userNameArg, int functionIdArg)
        {
            var allowance = CommonDao.ExecuteSqlScalar("Select [dbo].[fnAuthenticateUser]('" + userNameArg + "', " + functionIdArg + ")");

            if (allowance != null)
            {
                return CommonLogic.ConvertToLower(allowance) == "true";
            }

            return false; // Default return
        }
    }
}
